import { defHttp } from '/@/utils/http/axios';
import { ArticleParams, ArticleListGetResultModel } from './articleModel';

enum Api {
  List = '/company/pageCompanyArticle',
  SaveOrUpdate = '/company/saveOrUpdateCompanyArticle',
  Detail = '/company/detailCompanyArticle',
  Delete = '/company/deleteCompanyArticle',
}

// 请求接口

export const getList = (params?: ArticleParams) =>
  defHttp.get<ArticleListGetResultModel>({ url: Api.List, params });

export const saveOrUpdate = (params?: ArticleParams) =>
  defHttp.post({ url: Api.SaveOrUpdate, params}, { errorMessageMode: 'modal' });

export const detailById = (id: number) =>
  defHttp.get({ url: Api.Detail + `/${id}` });

export const delById = (id: number) =>
  defHttp.get({ url: Api.Delete + `/${id}` });
